package com.teradata.io.bio;

import java.io.IOException;
import java.util.Random;

/**
 * @Project: cmcchq
 * @Description:
 * @Version 1.0
 * @Throws :
 * @Author: <li>2019/6/14 lyndon Create 1.0
 * @Copyright (c)2019-2019 版权所有
 * @Modified By:
 */
public class Test {

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            try {
                Server.start();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }).start();

        Thread.sleep(100);

        char[] op = {'+', '-', '*', '/'};


        Random random = new Random(System.currentTimeMillis());

        new Thread(() -> {
           while (true) {
               String expression = random.nextInt(10) + "" + op[random.nextInt(4)] + (random.nextInt(10) + 1);
               Client.send(expression);
               try {
                   Thread.sleep(random.nextInt(1000));
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           }
        }).start();


    }

}
